'use strict';

module.exports = function(sequelize, DataTypes) {
    const pointRuleType = sequelize.define('pointRuleType', {
        id: {
            type: DataTypes.BIGINT(20).UNSIGNED,
            allowNull: false,
            autoIncrement: true,
            primaryKey: true,
            readonly: true
        },
        name: {
            type: DataTypes.STRING(191),
            allowNull: false
        },
        created_at: {
            type: DataTypes.DATE,
            allowNull: false,
            defaultValue: DataTypes.NOW,
            readonly: true
        },
        updated_at: {
            type: DataTypes.DATE,
            allowNull: false,
            defaultValue: DataTypes.NOW,
        }
    }, {
        tableName: 'sophic_point_rule_types',

        underscored: true,
        defaultScope: {
            attributes: ['id', 'name']
        },

        classMethods: {

            operationLog: true,

            associate: function(models) {

            }
        }
    });

    return pointRuleType;
};